# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=purism-ectool
pkgver=1.9
pkgrel=0
pkgdesc="EC firmware tool for Purism systems"
url="https://source.puri.sm/firmware/librem-ec"
arch="x86_64"
license="MIT"
makedepends="cargo eudev-dev linux-headers"
source="https://source.puri.sm/firmware/librem-ec/-/archive/$pkgver/librem-ec-$pkgver.tar.gz"
builddir="$srcdir/librem-ec-$pkgver/tool"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/purism_ectool \
		"$pkgdir"/usr/bin/purism_ectool
}

sha512sums="
f98f42b1f509c9fb1ba85d55321d32577f64062d5d819c48bb73cb93d71e5f2cf25d73d7ee945a8f147b6aba436b94944c770bc20553cc2406df95d3cfae72e4  librem-ec-1.9.tar.gz
"
